#pragma once
#include"RBTree.h"

namespace Myset {
	using namespace Tree;

	template<class K>
	class set
	{

		struct keyOfvalue {
			 const K operator()(const K& key)
			 {
				 return key;
			 }
		};
		typedef RBTree<const K, const K, keyOfvalue> Tree;


	public:
		typedef typename Tree::Iterator iterator;
		typedef typename Tree::const_Iterator const_iterator;
		typedef typename Tree::reverseIterator reverse_iterator;
		typedef typename Tree::const_reverse_Iterator const_reverse_iterator;

		pair<iterator,bool> insert(const K& data)
		{
			return _tr.Insert(data);
			
		}
		void swap( set& t)
		{
			_tr.swap(t._tr);
		}
		iterator begin()
		{
			return _tr.Begin();
		}

		iterator end()
		{
			return _tr.End();
		}

		const_iterator cbegin()
		{
			return _tr.cBegin();
		}
		const_iterator cend()
		{
			return _tr.cEnd();
		}
		reverse_iterator rbegin()
		{
			return _tr.rBegin();
		}

		reverse_iterator rend()
		{
			return _tr.rEnd();
		}
		
		const_reverse_iterator crbegin()
		{
			return _tr.crBegin();
		}
		const_reverse_iterator crend()
		{
			return _tr.crEnd();
		}
		iterator find(const K& key)
		{
			return _tr.Find(key);
		}

		const_iterator find(const K& key) const
		{
			return _tr.Find(key);
		}
		int size()
		{
			return _tr.size();
		}
		void clear()
		{
			_tr.Clear();
		}
		bool empty()
		{
			return _tr.Empty();
		}
	private:
		 Tree _tr;
	};
}